<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>开发一款软件，根据公式（身高-108）*2=体重，可以有10斤左右的浮动。来观察测试者体重是否为标准体重

        输入身高 还有体重 判断 体重是否是标准体重 ；</div>
    <input type="text" id="height" placeholder="输入身高cm">
    <input type="text" id="weight" placeholder="输入体重kg">
    <button id="btn">查询</button>
    <script>
        var height = document.getElementById("height");
        var weight = document.getElementById("weight");
        var btn = document.getElementById("btn");
        btn.onclick = function () {
            var a = parseFloat(height.value);
            var b = parseFloat(weight.value) * 2;
            var res = ( a - 108 ) * 2 - b;
            if ( res >= -10 && res <= 10 ) {
                window.alert("此身高体重是标准体重");
            } else {
                window.alert("此身高体重不是标准体重");
            }
        }
    </script>
</body>
</html>